package com.imonsoft.sqm.dao.business.supplier_quality;

import com.imonsoft.sqm.pojo.business.supplier_quality.Audit;
import com.imonsoft.sqm.pojo.business.supplier_quality.AuditExample;
import java.util.List;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Repository;
@SuppressWarnings("deprecation")
@Repository("auditDAO")
public class AuditDAOImpl extends SqlMapClientDaoSupport implements AuditDAO {

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table tt_audit
     *
     * @ibatorgenerated Thu Jun 06 09:19:37 CST 2013
     */
    public AuditDAOImpl() {
        super();
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table tt_audit
     *
     * @ibatorgenerated Thu Jun 06 09:19:37 CST 2013
     */
    public int countAuditByExample(AuditExample example) {
        Integer count = (Integer)  getSqlMapClientTemplate().queryForObject("tt_audit.ibatorgenerated_countByExample", example);
        return count;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table tt_audit
     *
     * @ibatorgenerated Thu Jun 06 09:19:37 CST 2013
     */
    public int deleteAuditByExample(AuditExample example) {
        int rows = getSqlMapClientTemplate().delete("tt_audit.ibatorgenerated_deleteByExample", example);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table tt_audit
     *
     * @ibatorgenerated Thu Jun 06 09:19:37 CST 2013
     */
    public int deleteAuditByPrimaryKey(Long id) {
        Audit key = new Audit();
        key.setId(id);
        int rows = getSqlMapClientTemplate().delete("tt_audit.ibatorgenerated_deleteByPrimaryKey", key);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table tt_audit
     *
     * @ibatorgenerated Thu Jun 06 09:19:37 CST 2013
     */
    public Long insertAudit(Audit record) {
        Object newKey = getSqlMapClientTemplate().insert("tt_audit.ibatorgenerated_insert", record);
        return (Long) newKey;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table tt_audit
     *
     * @ibatorgenerated Thu Jun 06 09:19:37 CST 2013
     */
    public Long insertAuditSelective(Audit record) {
        Object newKey = getSqlMapClientTemplate().insert("tt_audit.ibatorgenerated_insertSelective", record);
        return (Long) newKey;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table tt_audit
     *
     * @ibatorgenerated Thu Jun 06 09:19:37 CST 2013
     */
    @SuppressWarnings("unchecked")
    public List<Audit> selectAuditByExample(AuditExample example) {
        List<Audit> list = getSqlMapClientTemplate().queryForList("tt_audit.ibatorgenerated_selectByExample", example);
        return list;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table tt_audit
     *
     * @ibatorgenerated Thu Jun 06 09:19:37 CST 2013
     */
    public Audit selectAuditByPrimaryKey(Long id) {
        Audit key = new Audit();
        key.setId(id);
        Audit record = (Audit) getSqlMapClientTemplate().queryForObject("tt_audit.ibatorgenerated_selectByPrimaryKey", key);
        return record;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table tt_audit
     *
     * @ibatorgenerated Thu Jun 06 09:19:37 CST 2013
     */
    public int updateAuditByExampleSelective(Audit record, AuditExample example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("tt_audit.ibatorgenerated_updateByExampleSelective", parms);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table tt_audit
     *
     * @ibatorgenerated Thu Jun 06 09:19:37 CST 2013
     */
    public int updateAuditByExample(Audit record, AuditExample example) {
        UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
        int rows = getSqlMapClientTemplate().update("tt_audit.ibatorgenerated_updateByExample", parms);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table tt_audit
     *
     * @ibatorgenerated Thu Jun 06 09:19:37 CST 2013
     */
    public int updateAuditByPrimaryKeySelective(Audit record) {
        int rows = getSqlMapClientTemplate().update("tt_audit.ibatorgenerated_updateByPrimaryKeySelective", record);
        return rows;
    }

    /**
     * This method was generated by Apache iBATIS ibator.
     * This method corresponds to the database table tt_audit
     *
     * @ibatorgenerated Thu Jun 06 09:19:37 CST 2013
     */
    public int updateAuditByPrimaryKey(Audit record) {
        int rows = getSqlMapClientTemplate().update("tt_audit.ibatorgenerated_updateByPrimaryKey", record);
        return rows;
    }

    /**
     * This class was generated by Apache iBATIS ibator.
     * This class corresponds to the database table tt_audit
     *
     * @ibatorgenerated Thu Jun 06 09:19:37 CST 2013
     */
    private static class UpdateByExampleParms extends AuditExample {
        private Object record;

        public UpdateByExampleParms(Object record, AuditExample example) {
            super(example);
            this.record = record;
        }

        public Object getRecord() {
            return record;
        }
    }

	@Override
	public int countAuditByAudit(Audit audit) {
		 Integer count = (Integer)  getSqlMapClientTemplate().queryForObject("tt_audit.ibatorgenerated_countByAudit", audit);
		return count;
	}

	@SuppressWarnings("unchecked")
	@Override
	public List<Audit> selectAuditByAudit(Audit audit) {
		List<Audit> list = getSqlMapClientTemplate().queryForList("tt_audit.ibatorgenerated_selectByAudit", audit);
		return list;
	}
}